﻿using ControlHelper.Attributes;
using Creator.Core.Base; 
using System;
using System.Collections.Generic;

namespace Creator.Core.Component
{

    [ActionMenu("Basic/Actions")]
    [Obsolete("无用，设计有问题，找机会删掉")]
    public class ActionList : LogicComponet
    { 
        public ActionList(BaseObject baseObject) : base(baseObject)
        {

        }

 
        public List<IAction> Actions { get; private set; } = new List<IAction>();

    


        public override string Name => "过程集合";

        public override void Init()
        {
            foreach (var ac in Actions)
            {
                ac.Init();
            }
            base.Init();
        }

        public void AddAction(IAction action)
        {
            if (!Actions.Contains(action))
            {
                Actions.Add(action);
            }
        }
        public void RemoveAction(IAction action)
        {
            if (Actions.Contains(action))
            {
                Actions.Remove(action);
            }
        }

        public override void Run( double deltaTime)
        {
            foreach (var action in Actions)
            {
                action.Run(deltaTime);
            }

            base.Run(deltaTime);
        }
    }
}
